package io.fft.flight.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Author: likailun
 * @Description：证件类型
 * @Date: create in 2024/8/5 21:51
 */
@Getter
@AllArgsConstructor
public enum CardTypeEnum implements BaseEnum<Integer> {

    SHEN_FEN_ZHENG(1, "身份证"),
    HU_ZHAO(2, "护照"),
    TAI_BAO_ZHENG(5, "台胞证"),
    HUI_XIANG_ZHENG(7, "回乡证"),
    JUN_GUAN_ZHENG(8, "军官证"),
    OTHER(9, "其他"),
    WGR_YJJLZ(10, "外国人永久居留证"),
    GAT_JMJZZ(14, "港澳居民居住证"),
    TW_JMJZZ(15, "台湾居民居住证"),
    GA_TXZ(30, "港澳通行证"),
    GJ_HYZ(31, "国际海员证");

    private final Integer code;
    private final String message;

    public static Optional<CardTypeEnum> getByCode(Integer code) {
        return Arrays.stream(CardTypeEnum.values()).filter(item -> item.getCode().equals(code)).findAny();
    }
}
